$(function(){
		
		

		/*文字颜色报警*/
		// $(".warn").map(function(){
		// 	var prevHtml = $(this).html();
		// 	var nextHtml = $(this).context.nextElementSibling.innerHTML;
		// 	var ratio = prevHtml/nextHtml;
		// 	if (ratio<0.5) {
		// 	  $(this).context.parentNode.style.color = "#FF8282";
		// 	}
		// })

		/*获取后台数据*/
  		
  		var data = [{"create_time":null,"id":1,"jz":0,"lg":0,"tg":0,"xlxl":"王家湾大洋百货至汉商人信汇","yj":0,"zg":0,"zrdw":"王家湾警务站","zrs":0},{"create_time":null,"id":2,"jz":0,"lg":0,"tg":0,"xlxl":"古琴台转盘至鹦鹉大道翠微路路口","yj":0,"zg":0,"zrdw":"钟家村警务站","zrs":0},{"create_time":null,"id":3,"jz":0,"lg":0,"tg":0,"xlxl":"腰路堤路口至鹦鹉大道马鹦路路口","yj":0,"zg":0,"zrdw":"鹦鹉警务站","zrs":0},{"create_time":null,"id":4,"jz":0,"lg":0,"tg":0,"xlxl":"武汉动物园至龙江庭院","yj":0,"zg":0,"zrdw":"马沧湖警务站","zrs":0},{"create_time":null,"id":5,"jz":0,"lg":0,"tg":0,"xlxl":"琴台大道郭茨口路口至海天欢乐购","yj":0,"zg":0,"zrdw":"知音警务站","zrs":0},{"create_time":null,"id":6,"jz":0,"lg":0,"tg":0,"xlxl":"玫瑰园路沿线","yj":0,"zg":0,"zrdw":"二桥所","zrs":0},{"create_time":null,"id":7,"jz":0,"lg":0,"tg":0,"xlxl":"龙兴东街沿线","yj":0,"zg":0,"zrdw":"经开所","zrs":0},{"create_time":null,"id":8,"jz":0,"lg":0,"tg":0,"xlxl":"十升路沿线","yj":0,"zg":0,"zrdw":"琴断所","zrs":0},{"create_time":null,"id":9,"jz":0,"lg":0,"tg":0,"xlxl":"马沧湖路沿线","yj":0,"zg":0,"zrdw":"五里所","zrs":0},{"create_time":null,"id":10,"jz":0,"lg":0,"tg":0,"xlxl":"四台大道沿线","yj":0,"zg":0,"zrdw":"江北所","zrs":0},{"create_time":null,"id":11,"jz":0,"lg":0,"tg":0,"xlxl":"西大街沿线","yj":0,"zg":0,"zrdw":"建桥所","zrs":0},{"create_time":null,"id":12,"jz":0,"lg":0,"tg":0,"xlxl":"华园路沿线","yj":0,"zg":0,"zrdw":"月湖所","zrs":0},{"create_time":null,"id":13,"jz":0,"lg":0,"tg":0,"xlxl":"龟北路沿线","yj":0,"zg":0,"zrdw":"晴川所","zrs":0},{"create_time":null,"id":14,"jz":0,"lg":0,"tg":0,"xlxl":"夹河路沿线","yj":0,"zg":0,"zrdw":"鹦鹉所","zrs":0},{"create_time":null,"id":15,"jz":0,"lg":0,"tg":0,"xlxl":"建港路沿线","yj":0,"zg":0,"zrdw":"洲头所","zrs":0},{"create_time":null,"id":16,"jz":0,"lg":0,"tg":0,"xlxl":"江欣苑路沿线","yj":0,"zg":0,"zrdw":"江堤所","zrs":0},{"create_time":null,"id":17,"jz":0,"lg":0,"tg":0,"xlxl":"墨水湖南路沿线","yj":0,"zg":0,"zrdw":"四新所","zrs":0},{"create_time":null,"id":18,"jz":0,"lg":0,"tg":0,"xlxl":"翠微路沿线","yj":0,"zg":0,"zrdw":"翠微所","zrs":0},{"create_time":null,"id":19,"jz":0,"lg":0,"tg":0,"xlxl":"龙阳二路至龙阳三路沿线","yj":0,"zg":0,"zrdw":"永丰所","zrs":0},{"create_time":null,"id":20,"jz":0,"lg":0,"tg":0,"xlxl":"国博中心周边","yj":0,"zg":0,"zrdw":"国博所","zrs":0},{"create_time":null,"id":21,"jz":0,"lg":0,"tg":0,"xlxl":"王家湾家乐福门口","yj":0,"zg":0,"zrdw":"法制大队","zrs":0},{"create_time":null,"id":22,"jz":0,"lg":0,"tg":0,"xlxl":"汉商人信会门口","yj":0,"zg":0,"zrdw":"人口大队","zrs":0},{"create_time":null,"id":23,"jz":0,"lg":0,"tg":0,"xlxl":"汉商银座门口","yj":0,"zg":0,"zrdw":"刑侦大队","zrs":0},{"create_time":null,"id":24,"jz":0,"lg":0,"tg":0,"xlxl":"工商银行地铁站D出口","yj":0,"zg":0,"zrdw":"装备保障室禁毒大队","zrs":0},{"create_time":null,"id":25,"jz":0,"lg":0,"tg":0,"xlxl":"汉阳大道马沧湖路中","yj":0,"zg":0,"zrdw":"治安大队","zrs":0},{"create_time":null,"id":26,"jz":0,"lg":0,"tg":0,"xlxl":"动物园路五龙路路中","yj":0,"zg":0,"zrdw":"数据中心","zrs":0},{"create_time":null,"id":27,"jz":0,"lg":0,"tg":0,"xlxl":"海天欢乐购门口","yj":0,"zg":0,"zrdw":"反恐大队","zrs":0},{"create_time":null,"id":28,"jz":0,"lg":0,"tg":0,"xlxl":"玫瑰园路华大酒店路中","yj":0,"zg":0,"zrdw":"内保大队","zrs":0},{"create_time":null,"id":29,"jz":0,"lg":0,"tg":0,"xlxl":"鹦鹉风情镇路中","yj":0,"zg":0,"zrdw":"经侦大队","zrs":0},{"create_time":null,"id":30,"jz":0,"lg":0,"tg":0,"xlxl":"鹦鹉大道马鹦路路中","yj":0,"zg":0,"zrdw":"政治处国保大队","zrs":0}]
  		
  		var contentHtml = '';
  		
  		for (var i = 0; i < data.length; i++) {
  			contentHtml +='<li class="items">';
  			contentHtml +='<div class="items-content">';
  			contentHtml +='<div class="title">'+data[i].zrdw+'</div>';
  			contentHtml +='<div class="desc">'+data[i].xlxl+'</div>';
  			contentHtml +='<div class="details">';
  			contentHtml +='<div class="details-l fl">';
  			contentHtml +='<div class="up">';
  			contentHtml +='<div class="post fl">脱岗</div>';
  			contentHtml +='<div class="leave fl">'+data[i].tg+'</div>';
  			contentHtml +='</div>';
  			contentHtml +='<div class="up down">';
  			contentHtml +='<div class="post fl ">离岗</div>';
  			contentHtml +='<div class="leave fl">'+data[i].lg+'</div>';
  			contentHtml +='</div>';
  			contentHtml +='</div>';
  			contentHtml +='<div class="details-c fl">';
  			contentHtml +='<div class="num"><span class="warn">'+data[i].zg+'</span>/<span class="total">'+data[i].total+'</span></div>';
  			contentHtml +='<div class="guard"><span class="icon"></span>在岗</div>';
  			contentHtml +='</div>';
  			contentHtml +='<div class="details-l fl">';
  			contentHtml +='<div class="up leftup">';
  			contentHtml +='<div class="post fl">久坐</div>';
  			contentHtml +='<div class="leave fl">'+data[i].jz+'</div>';
  			contentHtml +='</div>';
  			contentHtml +='<div class="up leftdown">';
  			contentHtml +='<div class="post fl ">越界</div>';
  			contentHtml +='<div class="leave fl">'+data[i].yj+'</div>';
  			contentHtml +='</div>';
  			contentHtml +='</div>';
  			contentHtml +='</div>';
  			contentHtml +='</div>';
  			contentHtml +='</li>';
       
  		}
  		// console.log(contentHtml)
  		$("#carousel").html(contentHtml);

  		
  		//添加的内容
  		var data1 = {"cjcqy":0,"create_time":"2017-09-30 10:25:11","mchqy":1,"wjwqy":2,"ywqy":4,"zywqy":0};
  		var quyuHtml ='';
	  		quyuHtml +='<span class="map_quan1">王家湾<i>'+data1.wjwqy+'</i></span>';
	  		quyuHtml +='<span class="map_quan2">钟家村<i>'+data1.cjcqy+'</i></span>';
	  		quyuHtml +='<span class="map_quan3">马沧湖<i>'+data1.mchqy+'</i></span>';
	  		quyuHtml +='<span class="map_quan4">鹦鹉<i>'+data1.ywqy+'</i></span>';
	  		quyuHtml +='<span class="map_quan5">知音<i>'+data1.zywqy+'</i></span>';

  		$(".echart-center").append(quyuHtml);
  		
					
                    
                    
                    
                    

  		/*底部轮播图*/
  		var itemHeight = $("#carousel>.items")[0].offsetHeight;
		var total = Math.ceil($("#carousel>.items").length/3);
		
		var timer = null;
		var ul = $("#carousel");
		ul.append($("#carousel>.items:nth-of-type(-n+6)").clone())
		var ulOffsetHeight = ul[0].offsetTop;
		
		var targetHeight = 0;
		doMove();

		function doMove(){
			var i = 0;
			clearInterval(timer);
			timer = setInterval(function(){
				targetHeight = -275*i;
				if (i>total) {
					i=0;
					ul.css({top:0,transition: 'none'});
				}else{
					ul.css({top:targetHeight+'px',transition: 'top 1s'});
				}
				i++;
			}, 4000);
		};

		/*鼠标进入离开*/
		$(".stand-container").mouseover(function(){
			clearInterval(timer);
		}).mouseout(function(){
			doMove();
		})
});

